import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { userVO, userForm, userQuery } from '@/api/system/wxUser/types';

/**
 * 查询用户列表
 * @param query
 * @returns {*}
 */

export const listWxUser = (query?: userQuery): AxiosPromise<userVO[]> => {
  return request({
    url: '/system/member/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户详细
 * @param id
 */
export const getWxUser = (id: string | number): AxiosPromise<userVO> => {
  return request({
    url: '/system/member/' + id,
    method: 'get'
  });
};

/**
 * 新增用户
 * @param data
 */
export const addWxUser = (data: userForm) => {
  return request({
    url: '/system/member',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户
 * @param data
 */
export const updateWxUser = (data: userForm) => {
  return request({
    url: '/system/member',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户
 * @param id
 */
export const delWxUser = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/member/' + id,
    method: 'delete'
  });
};
